# this file provides examples of BCH encoding and decoding.
read "encoder.mpl":
read "decoder.mpl":

# realization of GF(2^4)
pol := alpha^4 + alpha + 1;

# an encoding example from the book.
msg := encode([1, 0, 1], 3, 2, 4, pol);

# an decoding example from the book.
rs := [1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1];
pair := decode(rs, 3, 2, 4, pol):
codes := pair[1];
errors := pair[2];
